﻿<%
'''测试伪继承
Sa.Extends("topAction")
Class indexAction
	
	'''测试私有函数传值
	Private Function ppp()
		ppp = "这是在indexAction中的一个私有函数下的返回值"
	End Function
	
	'''测试伪继承
	Public Sub index()
		Sa.Dim("i_s1")
		i_s1 = "本次进行伪继承测试:<br />"
		Sa.Dim("i_s2")
		i_s2 = "以下是在topAction中定义的可用变量:<br /><b>textdim、textname、textshw、textpri、textlang</b><br />"
		i_s2 = i_s2 & "由于topAction的构造函数已经进行了赋值操作，所以可以在模板中直接使用以上变量<br />"
		Sa.Dim("i_s3")
		i_s3 = "topAction又是继承于plistAction,这测试了多级继承<br/>"
		i_s3 = i_s3 & "以下是在plistAction中定义的可用变量:<br /><b>pextdim、pextname、pextshw、pextpri、pextlang</b><br />"
		i_s3 = i_s3 & "由于plistAction的构造函数未进行操作，所以必须使用以下方法使赋值生效：<br />"
		i_s3 = i_s3 & "<b>[Call] plist.ExtDim()</b><br /><b>[Call] plist.ExtLang()</b>"
		A_plist.ExtDim()
		A_plist.ExtLang()
		i_s3 = i_s3 & "现在变量已经生效啦,可以输出看看:<br />"
		Sa.Dim("i_s4")
		i_s4 = "在plistAction,我们使用了A-s-p..Use来载入了一个内置分页类,我们可以这样使用它：<br />"
		i_s4 = i_s4 & "<b>Pager.PageSize = 15</b><br /><b>Pager.ShowPageNowA = True</b>"
		i_s4 = i_s4 & "你发现了吗?变量Pager已经被定义,所以你不能再预定义一个Pager变量了,不然会出现变量重定义错误"
		Sa.Dim("svar")
		svar = "4"
		Sa.Dim("sarr")
		sarr = Array(1,2,3)
		Sa.Dim("sbtw")
		sbtw = 10
		Sa.Dim("sbtw_b")
		sbtw_b = 0
		Sa.Dim("sbtw_e")
		sbtw_e = 10
		Sa.Display("")
	End Sub
	
	'''雏形,Tpl..Sign决定废弃，改用dim预定义
	'已废弃的方法
	Public Sub display()
		Dim t_str1, t_str2, t_str3
		t_str1 = "aaa哈哈哈哈"
		t_str2 = "bbb呵呵呵呵"
		t_str3 = "ccc嘿嘿嘿嘿"
		Sa.Assign("str1")
		str1 = t_str1
		Sa.Assign("str2")
		str2 = t_str2
		Sa.Assign("str3")
		str3 = t_str3
		Sa.Assign("pp")
		pp = ppp()
		Sa.Show()
	End Sub
	
	'''测试dim预定义
	Public Sub [dim]()
		Sa.Dim("kwd")
		kwd = "这是用T-p-l..Dim方法来定义的一个字符串,他效率更高,生成的代码可读性更强,原生支持原有的类型"
		Sa.Dim("chen")
		Dim c1,c2,c3
		c1 = "陈"
		c2 = "峰"
		c3 = "展"
		chen = "我的名字叫：" & c1 & c2 & c3
		Sa.Dim("shw")
		shw = "而且这个例如还使用了T-p-l..Show来显示默认模板"
		Sa.Show
	End Sub
	
	'''输出select列表
	'已废弃的方法
	Public Sub foreach3()
		Dim names(5)
		names(0) = "George"
		names(1) = "John"
		names(2) = "Thomas"
		names(3) = "陈峰展"
		names(4) = "梁燕萍"
		names(5) = "闽南师范大学"
		Sa.Assign("Tn")
		Tn = names
		Sa.Display("")
	End Sub
	
	'''dimselect列表
	Public Sub [foreach]()
		Sa.Dim("namex|5")
		namex(0) = "定义固定大小的数组"
		namex(1) = "John"
		namex(2) = "Thomas"
		namex(3) = "陈峰展"
		namex(4) = "梁燕萍"
		namex(5) = "闽南师范大学"
		Sa.Show
	End Sub
	
	'''多维数组foreach标签
	Public Sub foreach2()
		Sa.Dim("tname|3|2")
		tname(0,0) = "定义固定大小的多维数组0X0"
		tname(0,1) = "定义固定大小的多维数组0X1"
		tname(0,2) = "定义固定大小的多维数组0X2"
		tname(1,0) = "定义固定大小的多维数组1X0"
		tname(1,1) = "定义固定大小的多维数组1X1"
		tname(1,2) = "定义固定大小的多维数组1X2"
		tname(2,0) = "定义固定大小的多维数组2X0"
		tname(2,1) = "定义固定大小的多维数组2X1"
		tname(2,2) = "定义固定大小的多维数组2X2"
		tname(3,0) = "定义固定大小的多维数组3X0"
		tname(3,1) = "定义固定大小的多维数组3X1"
		tname(3,2) = "定义固定大小的多维数组3X2"
		Sa.Show
	End Sub
	
	'''测试for标签解析
	Public Sub [for]()
		Sa.Show
	End Sub
	
	'''测试asp标签解析
	'发现C已被占用,故不能用作变量
	Public Sub tasp()
		Sa.Show
	End Sub
	
	'''测试多语
	Public Sub lang()
		Sa.Show
	End Sub
	
	'''测试记录集输出
	Public Sub record()
		Sa.Use("Db")
		Sa.Dim("rsnme")
		Db.Conn = Db.OpenConn(1,"/data/##db##/NewDataTest.mdb","")
		Set rsnme = Db.GetRecordBySql("Select * From Nclass Order By Id")
		Sa.Show
	End Sub
	
	'''测试使用SQL语句直接输出记录集
	Public Sub sql()
		Sa.Dim("dbconn")
		Sa.Dim("dbsql")
		Sa.Use("Db")
		Set dbconn = Db.OpenConn(1,"/data/##db##/NewDataTest.mdb","123456")
		dbsql = "Select * From Nclass Order By Id"
		Sa.Show
	End Sub
	
	'''直接输出
	Public Sub rw()
		Response.Write("abcdefg_ajax")
		Response.Write("这是直接输出的碗糕")
		Response.Write("GET变量k:")
		Response.Write(G("k"))
	End Sub
	
	'''json输出
	Public Sub tjson()
		Sa.Use("Json")
		Dim objarr
		Set objarr = Json.New(1)
		objarr(Null) = Json.New(0)
		objarr(Null)("ID") = 1
		objarr(Null)("Name") = "陈峰展"
		objarr(Null)("ClassType") = "好人"
		objarr(Null)("ParentID") = 0
		objarr(Null) = Json.New(0)
		objarr(Null)("ID") = 2
		objarr(Null)("Name") = "梁燕萍"
		objarr(Null)("ClassType") = "好人"
		objarr(Null)("ParentID") = 1
		objarr(Null) = Json.New(0)
		objarr(Null)("ID") = 3
		objarr(Null)("Name") = "梁小屁"
		objarr(Null)("ClassType") = "坏人"
		objarr(Null)("ParentID") = 2
		objarr.Flush
	End Sub
	
	'''测试Select标签
	Public Sub [select]()
		Sa.Dim("Chen")
		Chen = 1
		Sa.Dim("Liang")
		Liang = 2
		Sa.Dim("Tai")
		Tai = 0
		Sa.Dim("Zi")
		Zi = "你好ashapo!"
		Sa.Dim("Zi2")
		Zi2 = "你好ashapo!"
		Sa.Show
	End Sub
	
	Public Sub [Compare]()
		Sa.Dim("K1")
		K1 = 1
		Sa.Dim("K2")
		K2 = 2
		Sa.Show
	End Sub
	
	Public Sub [Object]()
		'强制指定使用内置的Mail类
		Call Sa.Object("Mail", "O_Mail", 2)
		O_Mail.SMTP = "smtp.qiye.163.com"
		O_Mail.LoginName = "fengzhan_chen@deya.cn"
		O_Mail.LoginPass = "daowomima-4"
		O_Mail.Domain = "deya.cn"
		O_Mail.FromMail = "fengzhan_chen@deya.cn"
		O_Mail.FromName = "陈峰展"
		O_Mail.ToMail = "fengzhan_chen@deya.cn"
		O_Mail.Subject = "这是一封测试邮件."
		O_Mail.Content = "这封测试邮件很重要，你懂的。"
		O_Mail.Priority = 1
		Response.Write(O_Mail.Object&"<br/>")
		O_Mail.CSend()
		'O_Mail.Send()
		Response.Write(O_Mail.Object&"<br/>")
		Response.Write(O_Mail.Code&"<br/>")
		Response.Write(O_Mail.Error&"<br/>")
	End Sub
	
	'''测试500错误
	Public Sub t500()
		Sa.Show()
	End Sub
	
	'''测试获取站点目录路径的一致性
	Public Sub twebpath()
		Response.Write(Request.ServerVariables("PATH_INFO"))
	End Sub
	
	'''
	Public Sub terrok()
		Dim t_ok
		t_ok = False
		If t_ok Then
			Sa.Success("操作成功!")
		Else
			Sa.JumpUrl = "http://www.baidu.com"
			Sa.Error("操作失败!")
		End If
	End Sub
	
	'测试Render渲染
	Public Sub render()
		Select Case Cstr(G("tt"))
		Case "1"
			Sa.Render("render1")
		Case "2"
			Sa.Render("public:render2")
		Case "3"
			Sa.Render("green:public:render3")
		Case "4"
			Sa.Render("test:ppc:index:render4")
		Case Else
			Response.Write("找不到能渲染的页面")
		End Select
	End Sub
End Class
%>